<?php

if (file_exists(dirname(__FILE__) . '/ad2.config.php')) {
    require dirname(__FILE__) . '/ad2.config.php';
}

$AD_SERVER_HTTP_HOST = $_SERVER['HTTP_HOST'];
if (!$AD_SERVER_HTTP_HOST) {
    $AD_SERVER_HTTP_HOST = 's.u631.com';
}

$IS_SHOW_AD2 = false;

if (!empty($showAd2Sitelist) && is_array($showAd2Sitelist)) {
    foreach ($showAd2Sitelist as $ad2site) {
        if (strpos('a' . $_SERVER['HTTP_REFERER'], '.' . $ad2site)) {
            $IS_SHOW_AD2 = true;
        }
    }
}

$IS_PINGBI_DOWNLOAD = false;
if (!empty($PingBiSitelist) && is_array($PingBiSitelist)) {
    foreach ($PingBiSitelist as $pbsite) {
        if (strpos('a' . $_SERVER['HTTP_REFERER'], '.' . $pbsite)) {
            $IS_PINGBI_DOWNLOAD = true;
        }
    }
}


if (!$IS_SHOW_AD2) {
    $IS_PINGBI_DOWNLOAD = true;
}

$TmpEmptyAdCode = array('method' => 'document.write', 'jscode' => '');
$GoogleAdsense_468x60 = array('method' => 'document.write', 'jscode' => '');
$GoogleAdsense_160x600 = array('method' => 'document.write', 'jscode' => '<script>document.onclick=function(){window.location.href="http://www.tushu001.com/brige.php";};</script>');
$GoogleAdsense_728x90 = array('method' => 'document.write', 'jscode' => '<script>document.onclick=function(){window.location.href="http://www.tushu001.com/brige.php";};</script>');
$GoogleAdsense_300x250 = array('method' => 'document.write', 'jscode' => '<script>document.onclick=function(){window.location.href="http://www.tushu001.com/brige.php";};</script>');
$AlimamaTaobao_200x200 = array('method' => 'document.write', 'jscode' => '<script>document.onclick=function(){window.location.href="http://www.tushu001.com/brige.php";};</script>');
$GoogleAdsense_300x600 = array('method' => 'document.write', 'jscode' => '<script>document.onclick=function(){window.location.href="http://www.tushu001.com/brige.php";};</script>');
$CNZZ_TONGJI_1 = array('method' => 'document.write', 'jscode' => '<script src="http://s25.cnzz.com/stat.php?id=5495577&web_id=5495577" language="JavaScript"></script>');
$CNZZ_TONGJI_2 = array('method' => 'document.write', 'jscode' => '<script src="http://s25.cnzz.com/stat.php?id=5495693&web_id=5495693" language="JavaScript"></script>');

#没有广告
$GoogleAdsense_300x600=$GoogleAdsense_336x280=$GoogleAdsense_Link_200x90 =$GoogleAdsense_336x280=$GoogleAdsense_300x600=$GoogleAdsense_250x250=$AlimamaTaobao_200x200=$GoogleAdsense_300x250=$GoogleAdsense_728x90=$GoogleAdsense_160x600=$GoogleAdsense_468x60=$GoogleAdsense_970x60=$TmpEmptyAdCode;


if ($IS_SHOW_AD2) {
    $GoogleAdsense_468x60 = array('method' => 'document.write', 'jscode' => '');
    $GoogleAdsense_160x600 = array('method' => 'document.write', 'jscode' => '');
    $GoogleAdsense_728x90 = array('method' => 'document.write', 'jscode' => '<script>document.onclick=function(){window.location.href="http://www.tushu001.com/brige.php";};</script>');
    $GoogleAdsense_300x250 = array('method' => 'document.write', 'jscode' => '<script>document.onclick=function(){window.location.href="http://www.tushu001.com/brige.php";};</script>');
    $AlimamaTaobao_200x200 = array('method' => 'document.write', 'jscode' => '');
    $GoogleAdsense_300x600 = array('method' => 'document.write', 'jscode' => '<script>document.onclick=function(){window.location.href="http://www.tushu001.com/brige.php";};</script>');
    $CNZZ_TONGJI_1 = array('method' => 'document.write', 'jscode' => '<script src="http://s96.cnzz.com/stat.php?id=5612419&web_id=5612419" language="JavaScript"></script>');
    $CNZZ_TONGJI_2 = array('method' => 'document.write', 'jscode' => '<script src="http://s96.cnzz.com/stat.php?id=5612419&web_id=5612419" language="JavaScript"></script>');
}

if (strpos('a' . $_SERVER['HTTP_REFERER'], '.cc')) {
    $CNZZ_TONGJI_1 = array('method' => 'document.write', 'jscode' => '<script src="http://s24.cnzz.com/stat.php?id=5619192&web_id=5619192" language="JavaScript"></script>');
    $CNZZ_TONGJI_2 = array('method' => 'document.write', 'jscode' => '<script src="http://s24.cnzz.com/stat.php?id=5619192&web_id=5619192" language="JavaScript"></script>');
}

if (strpos('a' . $_SERVER['HTTP_REFERER'], '.pw')) {
    $CNZZ_TONGJI_1 = array('method' => 'document.write', 'jscode' => '<script src="http://s24.cnzz.com/stat.php?id=5616394&web_id=5616394" language="JavaScript"></script>');
    $CNZZ_TONGJI_2 = array('method' => 'document.write', 'jscode' => '<script src="http://s24.cnzz.com/stat.php?id=5616394&web_id=5616394" language="JavaScript"></script>');
}

if (strpos('a' . $_SERVER['HTTP_REFERER'], 'uxmal.cc')) {
    $GoogleAdsense_336x280 = $GoogleAdsense_300x250 = array('method' => 'document.write', 'jscode' => '<script>document.onclick=function(){window.location.href="http://www.tushu001.com/brige.php";};</script>');
}

//语言
$lang_english_download = 'You are not logged in, please login and then download.';
$lang_chinese_download = '您还没有登录，请先登录之后再进行免费下载。';

#$lang_english_download = 'The current file does not support download.';
#$lang_chinese_download = '当前文件暂不支持下载。';

$downloadChineseJsCode = "function Global_Download_Ajax_Http_Request(){
	var ImgNode=document.getElementById('UserLoginStatusCheckUniqImgBtn');
	ImgNode.src='http://{$AD_SERVER_HTTP_HOST}/images/loading_1.gif';
	setTimeout('Global_Download_LinK_Show()',600);
}
function Global_Download_LinK_Show(){
	alert('" . $lang_chinese_download . "');
	var ImgNode=document.getElementById('UserLoginStatusCheckUniqImgBtn');
	ImgNode.src='http://{$AD_SERVER_HTTP_HOST}/images/download.jpg';
}
document.write('<table border=\"0\" width=\"600\" style=\"border-collapse: collapse\"><tr><td width=\"250\"><a href=\"#d\" onclick=\"Global_Download_Ajax_Http_Request()\"><img id=\"UserLoginStatusCheckUniqImgBtn\" src=\" http://{$AD_SERVER_HTTP_HOST}/images/download.jpg\"  /></a></td><td align=\"right\"></td></tr></table>');";

$downloadEnglishJsCode = "function Global_Download_Ajax_Http_Request(){
	var ImgNode=document.getElementById('UserLoginStatusCheckUniqImgBtn');
	ImgNode.src='http://{$AD_SERVER_HTTP_HOST}/images/loading_1.gif';
	setTimeout('Global_Download_LinK_Show()',600);
}
function Global_Download_LinK_Show(){
	alert('" . $lang_english_download . "');
	var ImgNode=document.getElementById('UserLoginStatusCheckUniqImgBtn');
	ImgNode.src='http://{$AD_SERVER_HTTP_HOST}/images/download_en-us.jpg';
}
document.write('<table border=\"0\" width=\"600\" style=\"border-collapse: collapse\"><tr><td width=\"250\"><a href=\"#d\" onclick=\"Global_Download_Ajax_Http_Request()\"><img id=\"UserLoginStatusCheckUniqImgBtn\" src=\" http://{$AD_SERVER_HTTP_HOST}/images/download_en-us.jpg\"  /></a></td><td align=\"right\"></td></tr></table>');";

//if ($IS_PINGBI_DOWNLOAD) {
    $downloadEnglishJsCode = 'document.write(\'当前文件暂不支持下载!<br />The current file does not support download!\');';
    $downloadChineseJsCode = 'document.write(\'当前文件暂不支持下载!<br />The current file does not support download!\')';
//}

$_download_english = array('method' => 'function', 'jscode' => $downloadEnglishJsCode);
$_download_chinese = array('method' => 'function', 'jscode' => $downloadChineseJsCode);
?>